package com.bot.nft.module.op.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bot.common.pojo.CommonResult;
import com.bot.nft.module.op.domain.bo.OpRofoListBo;
import com.bot.nft.module.op.domain.bo.OpRofoListQueryBo;
import com.bot.nft.module.op.domain.vo.OpRofoListVo;
import com.bot.nft.module.op.service.IRofolistService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 描述:
 * 时间: 2023-12-03 17:44
 * 负责人: 王速
 **/
@RestController
@RequestMapping("/rofo")
@CrossOrigin
public class OpRofoListController {
    @Resource
    private IRofolistService iRofolistService;

    /**
     * 查询优先购白名单信息
     */
    @PostMapping("/{pageNo}/{pageSize}/getRofoList.do")
    public CommonResult<Page<OpRofoListVo>> getRofoList(@RequestBody OpRofoListQueryBo rofoListQueryBo, @PathVariable("pageNo") Integer pageNo, @PathVariable("pageSize") Integer pageSize) {
        Page<OpRofoListVo> rofoList = iRofolistService.getRofoList(rofoListQueryBo.getId(), rofoListQueryBo.getName(), pageNo, pageSize);
        return CommonResult.data(rofoList);

    }

    /**
     * 添加优先购白名单
     */
    @PostMapping("/savrRofoList.do")
    public CommonResult<Boolean> addRofoList(@RequestBody OpRofoListBo rofoListBo) {
            Boolean signal = iRofolistService.addRofoList(rofoListBo);
            if (!signal) {
                return CommonResult.error();
            }
        return null;
    }

    /**
     * 删除优先购白名单
     */
    @GetMapping("/{mbId}/delRofoList.do")
    public CommonResult<Boolean> delRofoList(@PathVariable("mbId") String mbId) {
            Boolean signal = iRofolistService.delRofoList(mbId);
            if (!signal) {
                return CommonResult.error();
            }
        return null;
    }


}
